<template>
  <div class="steep">
    <div class="card-search cardTop">
      <el-tabs v-model="activeName" @tab-click="handleClick">
        <el-tab-pane label="一代电极正品" name="pinghengbiao1"></el-tab-pane>
        <el-tab-pane label="一代接头正品" name="pinghengbiao2"></el-tab-pane>
        <el-tab-pane label="一代坩埚正品" name="pinghengbiao3"></el-tab-pane>
        <el-tab-pane label="一代电极次品" name="pinghengbiao4"></el-tab-pane>
        <el-tab-pane label="一代接头次品" name="pinghengbiao5"></el-tab-pane>
        <el-tab-pane label="一代坩埚次品" name="pinghengbiao6"></el-tab-pane>
        <el-tab-pane label="一代电极外协" name="pinghengbiao7"></el-tab-pane>
        <el-tab-pane label="一代接头外协" name="pinghengbiao8"></el-tab-pane>
        <el-tab-pane label="一代坩埚外协" name="pinghengbiao9"></el-tab-pane>
        <el-tab-pane label="二代电极正品" name="pinghengbiao10"></el-tab-pane>
        <el-tab-pane label="二代接头正品" name="pinghengbiao11"></el-tab-pane>
        <el-tab-pane label="二代电极次品" name="pinghengbiao12"></el-tab-pane>
        <el-tab-pane label="二代接头次品" name="pinghengbiao13"></el-tab-pane>
        <el-tab-pane label="二代电极外协" name="pinghengbiao14"></el-tab-pane>
        <el-tab-pane label="二代接头外协" name="pinghengbiao15"></el-tab-pane>
        <!-- <el-tab-pane label="平衡表1" name="waixie"></el-tab-pane> -->
      </el-tabs>
    </div>
    <div class="card-table">
      <pinghengbiao :echartsData="showData"></pinghengbiao>
      <!-- <zhengpin v-if="zhengpinif" />
    <cipin v-if="cipinif" />
    <waixie v-if="waixieif" /> -->
    </div>
  </div>
</template>

<script>
// import zhengpin from './zhengpin.vue'
// import cipin from './cipin.vue'
// import waixie from './waixie.vue'
// import '@/mock/dataCenter.js'
import pinghengbiao from "./pinghengbiao";
// import { TotalListNowAnygetOutsideAll, TotalListNowAnygetBadAll, TotalListNowAnygetAll } from '../../../api/stock/BalanceSheet1'
// import { TotalListNowgetAll, TotalListNowgetOutsideAll, TotalListNowgetBadAll } from '../../../api/stock/BalanceSheet'
import {
  echartsData,
  echartsData1,
  echartsData2,
  echartsData3,
  echartsData4,
  echartsData5,
} from "../../../api/echartsData/balance";
export default {
  name: "test",
  // mixins: [dataCenter],
  components: {
    pinghengbiao,
    // zhengpin,
    // cipin,
    // waixie
  },
  data() {
    return {
      //   zhengpinif: true,
      //   cipinif: false,
      //   waixieif: false
      activeName: "pinghengbiao1",
      showData: [],
      data1: {},
      data2: {},
      data3: {},
      data4: {},
      data5: {},
      data6: {},
    };
  },
  computed: {},
  created() {
    // if (sessionStorage.getItem('activeTab')) {
    //   this.activeName = sessionStorage.getItem('activeTab')
    //   console.log('this', this.activeName)
    //   this.zhengpinif = false
    //   this.cipinif = false
    //   this.waixieif = false
    //   switch (sessionStorage.getItem('activeTab')) {
    //     case 'zhengpin':
    //       this.zhengpinif = true
    //       break
    //     case 'cipin':
    //       this.cipinif = true
    //       break
    //     case 'waixie':
    //       this.waixieif = true
    //       break
    //     default:
    //       break
    //   }
    // } else {
    //   sessionStorage.setItem('activeTab', this.activeName)
    // }
  },
  //   beforeRouteLeave (to, from, next) {
  //     sessionStorage.removeItem('activeTab')
  //     next()
  //   },
  mounted() {
    // this.getAllData()
    this.handleClick();
  },
  methods: {
    async handleClick(tab) {
      // console.log('tab', tab.name)
      // console.log(this.activeName)
      if (this.activeName === "pinghengbiao1") {
        const params = {
          mold: "电极",
        };
        const data = await echartsData(params);
        this.showData = data.data.data.pageData;
        this.showData.reverse();
      } else if (this.activeName === "pinghengbiao2") {
        const params = {
          mold: "接头",
        };
        const data = await echartsData(params);
        this.showData = data.data.data.pageData;
        this.showData.reverse();
      } else if (this.activeName === "pinghengbiao3") {
        const params = {
          mold: "坩埚",
        };
        const data = await echartsData(params);
        this.showData = data.data.data.pageData;
        this.showData.reverse();
      } else if (this.activeName === "pinghengbiao4") {
        const params = {
          mold: "电极",
        };
        const data = await echartsData1(params);
        console.log(data);
        this.showData = data.data.data.pageData;
        this.showData.reverse();
      } else if (this.activeName === "pinghengbiao5") {
        const params = {
          mold: "接头",
        };
        const data = await echartsData1(params);
        console.log(data);
        this.showData = data.data.data.pageData;
        this.showData.reverse();
      } else if (this.activeName === "pinghengbiao6") {
        const params = {
          mold: "坩埚",
        };
        const data = await echartsData1(params);
        console.log(data);
        this.showData = data.data.data.pageData;
        this.showData.reverse();
      } else if (this.activeName === "pinghengbiao7") {
        const params = {
          mold: "电极",
        };
        const data = await echartsData2(params);
        console.log(data);
        this.showData = data.data.data.pageData;
        this.showData.reverse();
      } else if (this.activeName === "pinghengbiao8") {
        const params = {
          mold: "接头",
        };
        const data = await echartsData2(params);
        console.log(data);
        this.showData = data.data.data.pageData;
        this.showData.reverse();
      } else if (this.activeName === "pinghengbiao9") {
        const params = {
          mold: "坩埚",
        };
        const data = await echartsData2(params);
        console.log(data);
        this.showData = data.data.data.pageData;
        this.showData.reverse();
      } else if (this.activeName === "pinghengbiao10") {
        const params = {
          mold: "电极",
        };
        const data = await echartsData3(params);
        console.log(data);
        this.showData = data.data.data.pageData;
        this.showData.reverse();
      } else if (this.activeName === "pinghengbiao11") {
        const params = {
          mold: "接头",
        };
        const data = await echartsData3(params);
        console.log(data);
        this.showData = data.data.data.pageData;
        this.showData.reverse();
      } else if (this.activeName === "pinghengbiao12") {
        const params = {
          mold: "电极",
        };
        const data = await echartsData4(params);
        console.log(data);
        this.showData = data.data.data.pageData;
        this.showData.reverse();
      } else if (this.activeName === "pinghengbiao13") {
        const params = {
          mold: "接头",
        };
        const data = await echartsData4(params);
        console.log(data);
        this.showData = data.data.data.pageData;
        this.showData.reverse();
      } else if (this.activeName === "pinghengbiao14") {
        const params = {
          mold: "电极",
        };
        const data = await echartsData5(params);
        console.log(data);
        this.showData = data.data.data.pageData;
        this.showData.reverse();
      } else if (this.activeName === "pinghengbiao15") {
        const params = {
          mold: "接头",
        };
        const data = await echartsData5(params);
        console.log(data);
        this.showData = data.data.data.pageData;
        this.showData.reverse();
      }
      //   sessionStorage.setItem('activeTab', tab.name)
      //   this.zhengpinif = false
      //   this.cipinif = false
      //   this.waixieif = false
      //   switch (tab.index) {
      //     case '0':
      //       this.zhengpinif = true
      //       break
      //     case '1':
      //       this.cipinif = true
      //       break
      //     case '2':
      //       this.waixieif = true
      //       break
      //     default:
      //       break
      //   }
    },
    // async getAllData () {
    //   const data = await TotalListNowAnygetOutsideAll()
    //   const data1 = await TotalListNowAnygetBadAll()
    //   const data2 = await TotalListNowAnygetAll()
    //   const data3 = await TotalListNowgetAll()
    //   const data4 = await TotalListNowgetOutsideAll()
    //   const data5 = await TotalListNowgetBadAll()
    //   console.log(data)
    //   console.log(data1)
    //   console.log(data2)
    //   console.log(data3)
    //   console.log(data4)
    //   console.log(data5)
    // }
  },
};
</script>


